package com.yupi.oj.judge.codesanbox;

import com.yupi.oj.judge.codesanbox.model.ExecuteCodeRequest;
import com.yupi.oj.judge.codesanbox.model.ExecuteCodeResponse;
import lombok.extern.slf4j.Slf4j;

/**
 * @Author FengHuan Wang
 * @Date 2025/3/9 10:17
 * @Version 1.0
 */

/**
 * 代码沙箱代理类
 */
@Slf4j
public class CodeSanBoxProxy implements CodeSanBox{

    public CodeSanBoxProxy(CodeSanBox codeSanBox) {
        this.codeSanBox = codeSanBox;
    }

    private final CodeSanBox codeSanBox;

    @Override
    public ExecuteCodeResponse executeCode(ExecuteCodeRequest executeCodeRequest) {
        log.info("开始调用代码沙箱: {}", executeCodeRequest.toString());
        ExecuteCodeResponse executeCodeResponse = codeSanBox.executeCode(executeCodeRequest);
        log.info("代码沙箱响应信息：{}", executeCodeResponse.toString());
        return executeCodeResponse;
    }
}
